/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file  rtl9010x.h
 * @brief Semidrive. AUTOSAR 4.3.1 MCAL EthTrcv plugins.
 */

#ifndef RTL9010X_H
#define RTL9010X_H

#ifdef __cplusplus
extern "C" {
#endif

#include "EthTrcv.h"

#define SD_MII_BMCR        0x00
#define SD_MII_BMSR        0x01
#define SD_MII_PHYSID1     0x02
#define SD_MII_PHYSID2     0x03


#if !defined(GENMASK)
#define GENMASK(h, l) \
    (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (32 - 1 - (h))))
#endif

#define SD_PHYID_OUI       GENMASK(31,10)
#define SD_PHYID_VENDOR    GENMASK(9,4)
#define SD_PHYID_VERSION   GENMASK(3,0)

#define PHY_LOOPBACK   (0x01<<14)

#define PHYSR_SPEED   GENMASK(5,4)
#define PHYSR_SPEED_OFFSET   4
#define PHYSR_SPEED_100M   1
#define PHYSR_SPEED_1000M  2


#if ETHTRCV_RTL9010X_SUPPORTED == STD_ON
extern const EthTrcv_Ops_Type rtl9010x_ops;
#endif

#ifdef __cplusplus
}
#endif

#endif

